#include <iostream>
#include <string>
#include <stdio.h>
#include <unistd.h>
using namespace std;

#define BARSTYLE '-'

void processbar(int cur, int goal)
{
    float percent = (float)cur / goal * 100;
    // printf("%f\n",percent);
    int count = percent;
    // printf("%d\n",count);
    string bar(count, BARSTYLE);
    printf(" [%-100s]%.1f%%\r", bar.c_str(), percent);
    fflush(stdout);
}

int main()
{

    for (int i = 1; i <= 100; ++i)
    {
        processbar(i, 100);
        usleep(100000);
    }
    printf("\n");
    return 0;
}